package cn.wolfcode.web.controller;


import cn.wolfcode.domain.Mylog;
import cn.wolfcode.service.IMylogService;
import cn.wolfcode.qo.QueryObject;
import cn.wolfcode.util.RequiredPermission;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ModelAttribute;

@Controller
@RequestMapping("/mylog")
public class MylogController {

    @Autowired
    private IMylogService mylogService;


    @RequestMapping("/list")
    public String list(Model model, @ModelAttribute("qo") QueryObject qo){
        PageInfo<Mylog> pageInfo = mylogService.query(qo);
        model.addAttribute("PageInfo", pageInfo);
        return "mylog/操作日志列表";
    }


    @RequiredPermission(name="日志删除",expression="mylog:delete")
    @RequestMapping("/delete")
    public String delete(Long id) {
        if (id != null) {
           mylogService.delete(id);
        }
        return "redirect:/mylog/list";
    }

}
